package com.manager.devicemanager.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.manager.devicemanager.entity.Alarmrecords;
import com.manager.devicemanager.mapper.AlarmrecordsMapper;
import com.manager.devicemanager.service.IAlarmrecordsService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.manager.devicemanager.vo.AlarmrecordsVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Collection;
import java.util.Comparator;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author wpf
 * @since 2025-06-24
 */
@Service
public class AlarmrecordsServiceImpl extends ServiceImpl<AlarmrecordsMapper, Alarmrecords> implements IAlarmrecordsService {
   @Autowired
    private AlarmrecordsMapper alarmrecordsMapper;

    @Override
    public List<AlarmrecordsVO> getPage(String dataSourceName) {
        List<AlarmrecordsVO> page1 = alarmrecordsMapper.getPage();
//        List<AlarmrecordsVO> page2 = alarmrecordsMapper.getICPage1();
        page1.forEach(item ->item.setDeviceName("设备"));
//        page2.forEach(item ->item.setDeviceName("设备2"));
//        page1.addAll(page2);
//        page1.sort(Comparator.comparing(AlarmrecordsVO::getTime).reversed());

        return page1;
    }


}
